package com.jml.表单重复提交;

import java.io.IOException;
import java.util.UUID;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/ToFormServlet")
public class ToFormServlet extends HttpServlet {

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		String token = UUID.randomUUID().toString();
		req.getSession().setAttribute("sessionToken",token);
		req.getRequestDispatcher("form.jsp").forward(req,resp);
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		String token = UUID.randomUUID().toString();
		req.getSession().setAttribute("sessionToken",token);
		req.getRequestDispatcher("form.jsp").forward(req,resp);
	}
}
